import request from '@/utils/request'
import {encodeParams} from '@/utils'

// 列表
export function getList(data) {
  return request({
    url: `/api/area?${encodeParams(data)}`,
    method: 'GET',
  })
}

// 列表
export function getAreaAll(data) {
  return request({
    url: `/api/area/_all`,
    method: 'GET',
  })
}

//添加
export function create(data) {
  return request({
    url: '/api/area',
    method: 'POST',
    data
  })
}

//启用禁用
export function changeEnable(id, enable) {
  return request({
    url: `/api/area/enable/${id}/${enable}`,
    method: 'GET',
  })
}

//根据id查询
export function getById(id) {
  return request({
    url: `/api/area/${id}`,
    method: 'GET',
  })
}

//更新area
export function update(id,data) {
  return request({
    url: `/api/area/${id}`,
    method: 'PUT',
    data
  })
}

//更新area
export function deleteIt(id) {
  return request({
    url: `/api/area/${id}`,
    method: 'DELETE',
  })
}

